﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.GamerServices;
using Antioch.Base;

namespace Antioch
{
    class ScreenConfirm : Screen
    {
		String _message;
		SpriteFont Font;
		public delegate void Callback(bool result);
		Callback _callback;

		public ScreenConfirm(String Message, Callback callback)
		{
			_message = Message;
			_callback = callback;
		}

        public override void Initialize()
        {
			
            Font = Content.Load<SpriteFont>("Antioch.Content/Hud");
        }

        public override void ButtonEvent(PlayerIndex index, Base.EventBasedInput.Buttons button, Base.EventBasedInput.EventTypes type, TimeSpan duration) 
        {
            if (button == EventBasedInput.Buttons.A && type == EventBasedInput.EventTypes.Pressed)
            {
				PopScreen();
				_callback(true);
            }
			if (button == EventBasedInput.Buttons.B && type == EventBasedInput.EventTypes.Pressed)
			{
				PopScreen();
				_callback(false);
			}  
        }

        public override void Update(GameTime gameTime)
        {
        }

        public override void Draw()
        {
			GraphicsDevice.Clear(Color.Black);
            SpriteBatch.Begin();
			//SpriteBatch.Draw(Title, new Rectangle(0,44,800,512), new Rectangle(112,0,800,512), Color.White);
            SpriteBatch.DrawString(Font, _message, new Vector2(256, 256), Color.White);
            SpriteBatch.End();
        }
    }
}
